import { _decorator, Component, EventTouch, log, Node, Sprite, SpriteFrame } from 'cc';
import { CameraController } from './CameraController';
import { BattleManager } from './BattleManager';
const { ccclass, property } = _decorator;

@ccclass('SetController')
export class SetController extends Component {

    @property(Node)
    MaskNode: Node = null;

    @property(Sprite)
    MusicSprite: Sprite = null;

    @property(Sprite)
    EffectSprite: Sprite = null;

    @property(SpriteFrame)
    OpenSF: SpriteFrame = null;
    @property(SpriteFrame)
    CloseSF: SpriteFrame = null;

    private _isOpenMusic: boolean = true;
    private _isOpenEffect: boolean = true;

    setClick() {
        this.node.active = true;
    }

    musicBtn() {
        this._isOpenMusic = !this._isOpenMusic;
        if (this._isOpenMusic) {
            this.MusicSprite.spriteFrame = this.OpenSF;
        } else {
            this.MusicSprite.spriteFrame = this.CloseSF;
        }
    }

    effectBtn() {
        this._isOpenEffect = !this._isOpenEffect;
        if (this._isOpenEffect) {
            this.EffectSprite.spriteFrame = this.OpenSF;
        } else {
            this.EffectSprite.spriteFrame = this.CloseSF;
        }
    }

    // TouchEvent(event: EventTouch) {
    //     BattleManager.Instance.gameResume();
    //     CameraController.Instance.isPause = false;
    // }

    // protected onEnable(): void {
    //     this.MaskNode.on(Node.EventType.TOUCH_END, this.TouchEvent, this);
    // }

    // protected onDisable(): void {
    //     this.MaskNode.off(Node.EventType.TOUCH_END, this.TouchEvent, this);
    // }

}


